import { store } from '@/store'
interface menuStore {
  menuList: any[]
}

const menuStore = defineStore('menuList', {
  state: (): menuStore => ({
    menuList: [],
  }),
  actions: {
    setMenu(menuList: any) {
      this.menuList = menuList
    },
  },
  // 持久化插件
  persist: {
    enabled: true,
    strategies: [
      {
        key: 'menuList',
        storage: sessionStorage,
      },
    ],
  },
})

export function useMenuStore() {
  return menuStore(store)
}
